package com.superman.supermarket.client.composite.mycouponlist;

import java.util.Map;

import com.superman.supermarket.client.composite.mycouponlist.touse.CouponUseAllJumper;
import com.superman.supermarket.client.composite.mycouponlist.touse.CouponUseCatalogJumper;
import com.superman.supermarket.client.composite.mycouponlist.touse.CouponUseGoodsJumper;
import com.superman.supermarket.client.composite.mycouponlist.touse.CouponUseSpecialJumper;
import com.superman.supermarket.client.composite.mycouponlist.touse.CouponUseStoreCatalogJumper;
import com.superman.supermarket.client.composite.mycouponlist.touse.ICouponUseJumper;
import com.superman.supermarket.client.constant.StoreCouponConstants;

/**
 * 优惠券使用工厂累
 * 
 * @author superman
 * @version 2018年8月19日下午11:33:01
 */
public class CouponUseJumperFactory {

	/**
	 * 去使用
	 * 
	 * @author superman
	 * @version 2018年8月19日 下午11:33:11
	 * @param map
	 */
	public static void toUse(Map<String, Object> map) {
		ICouponUseJumper couponUseJumper = null;
		int limitType = (int) Double.parseDouble(String.valueOf(map.get("SCENE_TYPE")));

		// 限制值
		switch (limitType) {
			case StoreCouponConstants.LIMIT_TYPE_NO_LIMIT:
				couponUseJumper = new CouponUseAllJumper();
				break;
			case StoreCouponConstants.LIMIT_TYPE_LIMIT_CATAGORY:
				couponUseJumper = new CouponUseCatalogJumper();
				break;
			case StoreCouponConstants.LIMIT_TYPE_LIMIT_SPECIAL:
				couponUseJumper = new CouponUseSpecialJumper();
				break;
			case StoreCouponConstants.LIMIT_TYPE_LIMIT_SPU:
				couponUseJumper = new CouponUseGoodsJumper();
				break;
			case StoreCouponConstants.LIMIT_TYPE_LIMIT_STORE_CATAGORY:
				couponUseJumper = new CouponUseStoreCatalogJumper();
				break;
			default:
				break;
		}

		if (couponUseJumper != null)
			couponUseJumper.toUse(map);
	}

}
